import React from 'react';
import { withRouter } from 'react-router-dom';
import { connect } from 'react-redux';
import reducer, { showErrmsg, resetPsd } from '../../store/user';
import ChangePsd from '../../components/user/ChangePsd';
import { injectReducer } from '../../store/reducers';
import store from '../../store/createStore';
const mapStateToProps = state => ({
  errMsg: state.user.errMsg,
  loading: state.user.loading,
  phone: state.user.userInfo.phone
});

const mapDispatchToProps = {
  resetPsd,
  showErrmsg
};

injectReducer(store, { key: 'user', reducer });
export default withRouter(
  connect(
    mapStateToProps,
    mapDispatchToProps
  )(ChangePsd)
);
